package model

import "time"

// ChatQuickReply 快捷回复模型（常用话术）
type ChatQuickReply struct {
	ID        uint      `gorm:"primaryKey" json:"id"`
	StaffID   uint      `gorm:"index;comment:客服ID,0表示全局话术" json:"staffId"` // 0 表示全局话术
	Title     string    `gorm:"size:100;not null;comment:话术标题" json:"title"`
	Content   string    `gorm:"type:text;not null;comment:话术内容" json:"content"`
	Category  string    `gorm:"size:50;index;comment:分类" json:"category"` // greeting, faq, closing, etc
	SortOrder int       `gorm:"default:0;comment:排序" json:"sortOrder"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

// TableName 指定表名
func (ChatQuickReply) TableName() string {
	return "chat_quick_replies"
}

// QuickReplyCategory 快捷回复分类
const (
	QuickReplyCategoryGreeting = "greeting" // 问候语
	QuickReplyCategoryFAQ      = "faq"      // 常见问题
	QuickReplyCategoryClosing  = "closing"  // 结束语
	QuickReplyCategoryOther    = "other"    // 其他
)

// CreateQuickReplyReq 创建快捷回复请求
type CreateQuickReplyReq struct {
	Title     string `json:"title" binding:"required,max=100"`
	Content   string `json:"content" binding:"required,max=2000"`
	Category  string `json:"category" binding:"required,oneof=greeting faq closing other"`
	SortOrder int    `json:"sortOrder"`
	IsGlobal  bool   `json:"isGlobal"` // 是否全局话术（仅管理员可创建）
}

// UpdateQuickReplyReq 更新快捷回复请求
type UpdateQuickReplyReq struct {
	Title     string `json:"title" binding:"max=100"`
	Content   string `json:"content" binding:"max=2000"`
	Category  string `json:"category" binding:"omitempty,oneof=greeting faq closing other"`
	SortOrder *int   `json:"sortOrder"`
}

// QuickReplyListReq 快捷回复列表请求
type QuickReplyListReq struct {
	Category string `form:"category"`      // 分类筛选
	IsGlobal *bool  `form:"isGlobal"`      // 是否只看全局话术
	Page     int    `form:"page"`          // 页码
	PageSize int    `form:"pageSize"`      // 每页数量
}

// QuickReplyListResp 快捷回复列表响应
type QuickReplyListResp struct {
	List     []ChatQuickReply `json:"list"`
	Total    int64            `json:"total"`
	Page     int              `json:"page"`
	PageSize int              `json:"pageSize"`
}

